package com.jt;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
public class ScaProviderApplication {

    public static void main(String[] args) {
        SpringApplication.run(ScaProviderApplication.class, args);
    }

    @Value("${server.port}")
    private String server;
    @Value("${logging.level.com.jt.sca:error}")
    private String loglevel;
    @Value("${server.tomcat.threads.max:50}")
    private int maxThread;
    @Value("${page.pageSize:5}")
    private int pageSize;

    @RefreshScope
    @RestController
    public class ProviderController {
        @RequestMapping("/page/dogetPageSize")
        public String dogetPageSize(){
            return "pageSize is " + pageSize;
        }
        @RequestMapping("/provider/dogetloglevel")
        public String dogetprivate(){
                return "level is"+loglevel;
        }
        @RequestMapping("/thread/dogetThread")
        public String dogetThread(){
            return "thread is " + maxThread;
        }
        @GetMapping(value = "/provider/echo/{msg}")
        public String doEcho(@PathVariable String msg) {
            return server+"say:Hello Nacos Discovery " + msg;
        }
    }
}
